<?php
set_time_limit(0);
$root=preg_replace('/cron$/', '', dirname(__FILE__));

require_once($root."inc.config.php");

require_once($root."initialize.php");

if(($db_msg=cron_initialize()) !== true){

	print_r("Connection error");

}else{ 

	$db=$vars["db"];
	$id=1;
	$share = 1000;
	$date = date('Y-m-d H:i:s');
	$ttl_share = mysql_result(mysql_query("select swallet from gg_users where id=".$id), 0) or 0;
	
	for($i=1; $i<=100; $i++){
		$ttl_share+=$share;
		$sql = "INSERT INTO gg_member_swallet_record SET uid=".$id.",type='credit',amount=".$share.",bal=".$ttl_share.",cdate='".$date."'";
		mysql_query($sql);
		$sql = "INSERT INTO gg_share SET uid=".$id.",total_unit=".$share.",buy_price=1.00,sell_price=2.30,status=1,buy_date='".$date."',selling_datetime='".$date."',trade_date='".date('Y-m-d')."',replica=1";
		mysql_query($sql);
		
	}
	mysql_query("UPDATE gg_users SET swallet=".$ttl_share." WHERE id=".$id);
	
	print_r("finish");
}
?>